/**
 * $Id: UserRepositoryImpl.java 19 2011-06-11 04:06:06Z feigme $
 */
package com.iary.infrastructure.orm.hibernate;

import org.springframework.stereotype.Repository;

import com.iary.domain.model.user.User;
import com.iary.domain.model.user.UserRepository;

@Repository
public class UserRepositoryImpl extends HibernateDao<User, Long> implements
		UserRepository {

	public User findUserByEmail(String email) {
		return (User) getSession()
				.createQuery("from User where email = :email").setParameter(
						"email", email).uniqueResult();
	}

	public User findUserByUserName(String userName) {
		return (User) getSession().createQuery(
				"from User where userName = :userName").setParameter(
				"userName", userName).uniqueResult();
	}

}
